package com.example.hospitalmanagement.fragment

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.example.hospitalmanagement.R
import com.example.hospitalmanagement.bean.NameMassage

class IndividualFragmentAdapter(context: Context) :
    RecyclerView.Adapter<IndividualFragmentAdapter.IndividualHodel>() {
    val context: Context = context
    lateinit var dataList: MutableList<NameMassage>

    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): IndividualHodel {
        var hodeler = IndividualHodel(
            LayoutInflater.from(context).inflate(R.layout.my_patients_entrance, parent, false)
        )
        return hodeler
    }

    override fun onBindViewHolder(holder: IndividualHodel, position: Int) {
        holder.itemsNumber.text = dataList[position].itemNumber
        holder.itemsIDNumber.text = dataList[position].itemIDNumber
        holder.itemsName.text = dataList[position].itemName
    }

    override fun getItemCount(): Int {
        return if (null == dataList) 0 else dataList.size
    }

    inner class IndividualHodel(view: View) : RecyclerView.ViewHolder(view) {
        var itemsNumber: TextView = view.findViewById(R.id.text_treatment_number)
        var itemsIDNumber: TextView = view.findViewById(R.id.text_ID_number)
        var itemsName: TextView = view.findViewById(R.id.my_name)

    }
}